import type { UploadUserFile } from 'element-plus'

export interface GetProductSPUParams {
  page: number
  limit: number
  category3Id: number
}

export interface ProductSPUData {
  records: ProductSPURecords
  total: number
  size?: number
  current?: number
  orders?: []
  optimizeCountSql?: boolean
  hitCount?: boolean
  countId?: null
  maxLimit?: null
  searchCount?: boolean
  pages?: number
}

export type ProductSPURecords = ProductSPURecord[]

export interface ProductSPURecord {
  id?: number
  spuName: string
  description: string
  category3Id: number
  tmId?: number
  spuSaleAttrList: []
  spuImageList: []
  spuPosterList?: []
}

// 基本销售属性的类型
export type SaleAttrList = SaleAttrItem[]
export interface SaleAttrItem {
  id: number
  name: string
  // showNum?: any
  // spuSaleAttrList?: SpuSaleAttrListType[]
}
export interface TableDataType {
  showNum?: boolean
  spuSaleAttrValueList: TableSpuSaleAttrListType[]
  baseSaleAttrId: number
  saleAttrName: string
}
interface TableSpuSaleAttrListType {
  baseSaleAttrId: number
  saleAttrValueName: string
}
// 基本品牌信息的接口
export interface BaseTrandemark {
  id: number
  tmName: string
  logoUrl: string
}

export type BaseTrandemarkList = BaseTrandemark[]

// 添加spu属性时参数的类型-----------------------从这开始，太多了！！
export interface SPUParamsType {
  id?: number
  category3Id?: number
  spuName: string
  tmId: undefined | number
  description: string
  spuSaleAttrList: SpuSaleAttrListType[]
}
export interface SPUParamsType2 extends SPUParamsType {
  spuImageList: SpuImageListType[]
  isEdit?: boolean
}
export interface SPUFromDataType2 extends SPUParamsType {
  spuImageList: UploadUserFile[]
}

// 属性值列表接口
export interface SpuSaleAttrListType {
  id?: number
  baseSaleAttrId: number
  saleAttrName: string
  spuId?: number
  showNum?: boolean
  spuSaleAttrValueList: SpuSaleAttrValueListType[]
}
export interface SpuSaleAttrValueListType {
  baseSaleAttrId: number
  isChecked?: string
  saleAttrName?: string
  saleAttrValueName: string
  spuId?: number
  id: number
}
// 图片列表接口
export interface SpuImageListType {
  imgName: string
  imgUrl: string
}

// sku预览信息的接口
export type FindBySpuIdDataList = FindBySpuIdDataItem[]

export interface FindBySpuIdDataItem {
  id: number
  spuId: number
  price: number
  skuName: string
  skuDesc: string
  weight: string
  tmId: number
  category3Id: number
  skuDefaultImg: string
  isSale: number
  skuImageList: null
  skuAttrValueList: null
  skuSaleAttrValueList: null
}
interface AA {
  category3Id?: number
  id?: number
  isSale?: number
  price: string
  skuName: string
  spuId: number
  tmId?: number
  weight: string
  skuDefaultImg: string
  skuDesc: string
  skuImageList: SkuImageList
}
// 添加sku的参数接口
export interface SaveSkuInfoParams extends AA {
  skuAttrValueList: SkuAttrValueList
  skuSaleAttrValueList: SkuSaleAttrValueList
}
export interface SaveSkuInfoParams2 extends AA {
  skuAttrValueList: string[]
  skuSaleAttrValueList: string[]
}
export type SkuAttrValueList = SkuAttrValueitem[]
export interface SkuAttrValueitem {
  attrId: number
  attrName?: string
  id?: number
  skuId?: number
  valueId: number
  valueName?: string
}
export type SkuImageList = SkuImageItem[]
export interface SkuImageItem {
  imgName: string
  imgUrl: string
  id?: number
  isDefault?: string
  skuId?: number
  spuImgId?: number
}
export type SkuSaleAttrValueList = SkuSaleAttrValueItem[]
export interface SkuSaleAttrValueItem {
  id?: number
  saleAttrId?: number
  saleAttrName?: string
  saleAttrValueId: number
  saleAttrValueName?: string
  skuId?: number
  spuId?: number
}

// 商品基础属性的接口
export type AttrInfoList = AttrInfoItem[]
export interface AttrInfoItem {
  id: number
  attrName: string
  categoryId: number
  categoryLevel: number
  attrValueList: AttrValueList
}
export type AttrValueList = AttrValueItem[]
export interface AttrValueItem {
  id: number
  valueName: 'string'
  attrId: number
}
